package com.pkk.cloud.support.admin.oauth2.api.interceptor;

import com.alibaba.fastjson.JSONObject;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

/**
 * @description: feign的请求拦截器
 * @author: peikunkun
 * @create: 2020-03-20 09:32
 **/
public class FeignRequestInterceptor implements RequestInterceptor {


  @Override
  public void apply(RequestTemplate template) {
    ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder
        .getRequestAttributes();
    System.out.println(JSONObject.toJSONString(template));

  }
}
